/* Copyright(c) 2010- Siro-info Co.(http://www.siro-info.com)
 * All rights reserved.
 */
package com.siro.pm.model.provider;

import com.siro.pm.I18nManager;
import com.vaadin.data.Item;
import com.vaadin.data.util.HierarchicalContainer;
import com.vaadin.terminal.ThemeResource;

/**
 * Class Declaration:
 * 
 * @version v1.0
 * @since AdminTreeProvider.java v1.0
 */
public class AdminTreeProvider {
	public static String ADMIN_PROPERTY_NAME = "name";
	public static String ADMIN_PROPERTY_ICON = "icon";

	public static String ADMIN_ITEM_PROJECT = "project";
	public static String ADMIN_ITEM_DEVELOPER = "developer";
	public static String ADMIN_ITEM_MODIFYPWD = "modifypwd";
	public static String ADMIN_ITEM_ATTENDANCE = "attendance ";

	static HierarchicalContainer adminTreeContainer;
	static {
		adminTreeContainer = new HierarchicalContainer();
		adminTreeContainer.addContainerProperty(ADMIN_PROPERTY_NAME,
				String.class, null);
		adminTreeContainer.addContainerProperty(ADMIN_PROPERTY_ICON,
				ThemeResource.class, new ThemeResource(
						"../siropm/img/folder.gif"));
	}

	public static HierarchicalContainer getAdminTreeContainer() {
		adminTreeContainer.removeAllItems();

		// project
		Item item_project = adminTreeContainer.addItem(ADMIN_ITEM_PROJECT);
		item_project.getItemProperty(ADMIN_PROPERTY_NAME).setValue(
				I18nManager.getMessage("adminview.project"));
		item_project.getItemProperty(ADMIN_PROPERTY_ICON).setValue(
				new ThemeResource("../siropm/img/project_bugs.gif"));
		adminTreeContainer.setChildrenAllowed(ADMIN_ITEM_PROJECT, false);

		// developer
		Item item_developer = adminTreeContainer.addItem(ADMIN_ITEM_DEVELOPER);
		item_developer.getItemProperty(ADMIN_PROPERTY_NAME).setValue(
				I18nManager.getMessage("adminview.developer"));
		item_developer.getItemProperty(ADMIN_PROPERTY_ICON).setValue(
				new ThemeResource("../siropm/img/project_developer.png"));
		adminTreeContainer.setChildrenAllowed(ADMIN_ITEM_DEVELOPER, false);

		// modify pwd
		Item item_modifypwd = adminTreeContainer.addItem(ADMIN_ITEM_MODIFYPWD);
		item_modifypwd.getItemProperty(ADMIN_PROPERTY_NAME).setValue(
				I18nManager.getMessage("adminview.modifypwd"));
		item_modifypwd.getItemProperty(ADMIN_PROPERTY_ICON).setValue(
				new ThemeResource("../siropm/img/siropm_modifypwd.gif"));
		adminTreeContainer.setChildrenAllowed(ADMIN_ITEM_MODIFYPWD, false);
		
		return adminTreeContainer;
	}

}
